<template>
  <div id="app">
    <router-view v-if="this.restToken!==''&&this.userInfo !=''" :userInfo="userInfo"></router-view>
  </div>
</template>
<script>
export default {
  components: {},
  data() {
    return {
      restToken: "",
      userInfo: ""//登录人信息
    };
  },
  async created() {
    await this.checkLogin();
  },
  beforeDestroy() {},
  watch: {},
  computed: {},
  methods: {
    checkLogin() {
      this.axios({
        url: "/seeyon/selectModel.do?method=getRestToken",
        method: "get",
        headers: {
          "Content-Type": "application/json",
        },
      }).then((res) => {
        this.restToken = res.data.id || res.data;
        console.log("this.restToken", res);
        localStorage.setItem("restToken", this.restToken);
        const userInfo = window.location.href.split('Info=')[1].split('&code=')[0];
        this.axios({
          url: "/seeyon/rest/select/checkLogin",
          method: "post",
          headers: {
            "Content-Type": "application/json",
            "token":this.restToken
          },
          data: {
            userInfo: userInfo,
          },
        }).then((res) => {
          console.log("登录校验", res);
          if (res.data.data.checkResult == 'true') {
            this.userInfo = res.data.data;
            localStorage.setItem("loginName", res.data.data.loginName);
          }
          else {
            window.location.href = res.data.data.redirectUrl;
          }
          
        });
        });
    },
  },
};
</script>
<style>
.custom-message-position {
  top: 260px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}
#app {
  width: 100%;
  height: 100%;
  min-width: 1460px;
  box-sizing: border-box;
  background-image: url("@/imgs/topBg.png");
  background-repeat: no-repeat;
  background-color: #eff3fe;
  background-size: 100% 20%;
}

/* 整个滚动条 */
::-webkit-scrollbar {
  width: 6px; /* 滚动条宽度 */
  height: 6px; /* 滚动条高度 */
}

/* 滚动条轨道 */
::-webkit-scrollbar-track {
  background: #f1f1f1; /* 轨道背景色 */
  border-radius: 10px; /* 轨道圆角 */
}

/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
  background: #888; /* 滑块颜色 */
  border-radius: 10px; /* 滑块圆角 */
}

/* 滚动条滑块悬停 */
::-webkit-scrollbar-thumb:hover {
  background: #555; /* 悬停时的滑块颜色 */
}
</style>
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
</style>